package com.ymttest.database.sqlwapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.sun.org.apache.bcel.internal.generic.NEW;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.database.SqlManager;
import com.ymttest.database.model.LoginLog;
import com.ymttest.utils.EnvSetup;

public class YmtAdLogWapper {
	SqlManager manage;

	public YmtAdLogWapper() {
		manage = new SqlManager("adsys");
	}

	
	
	public Integer selectLogCount() throws InterruptedException {
		List<Map> m = (List<Map>) manage.getSelectResults("com.ymttest.database.mapping.YmtAdLogMapper.selectLogCount", null);
		manage.commit();
		
		Number pia = (Number) m.get(0).get("count");
	
		return pia.intValue();
	}
	
	public List<Map> selectLogDetails() throws InterruptedException {
		List<Map> m = (List<Map>) manage.getSelectResults("com.ymttest.database.mapping.YmtAdLogMapper.selectLogDetails", null);
		manage.commit();
		return m;
	}
	
	/**
	 * 关闭数据库连接
	 */
	public void close() {
		manage.close();
	}

	@Override
	protected void finalize() throws Throwable {
		this.close();
		manage = null;
		super.finalize();
	}
	
	public static void main(String[] args)  {
		
		try {
			List<Map> aInteger = new YmtAdLogWapper().selectLogDetails();
			System.out.println(aInteger);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	
	}
}
